//
//  Constant.swift
//  UserApp_iOS
//
//  Created by linlin on 2019/9/10.
//  Copyright © 2019 linlin. All rights reserved.
//

import Foundation
import UIKit

let screenWidth: CGFloat = UIScreen.main.bounds.width
let screenHeight: CGFloat = UIScreen.main.bounds.height
let appDelegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
var appVersion: String {
    let infoplist = Bundle.main.infoDictionary
    return (infoplist?["CFBundleShortVersionString"] as? String) ?? ""
}
//var sessionId: String? {
//    return UserManager.defult.sessionId
//}

//微信登录分享
let UniversalLinks = "https://www.qipei128.com/ulink/"
let wxAppid = "wx15e35b48aa8593e5"
let wxAppSecrete = "b96c0d9aafe0e19dd9581d5b798498a5"
let alipayScheme = "supplieralipay"

#if DEBUG
let kGtAppId = "S73tbQZLa7A0AN0HgBnvd9"
let kGtAppKey = "VRI0FnTp2m5d4ZaZbBrcS4"
let kGtAppSecret = "RX4KGvwf948xNXvx0gfhy6"
let kApnsCername = "apnsdev"
let kPkCername = "pkdis"
#else //生产环境
let kGtAppId = "xDkUzlI34iAHl4l0HQe228"
let kGtAppKey = "Of7kLmDRKm9VwqLAH1ayf8"
let kGtAppSecret = "htSFSF0ADF9FrP4vuGNlx3"
let kApnsCername = "apnsdis"
let kPkCername = "pkdis"
#endif

//UserDefault键值常量
let USER_DEFAULT_KEY_USERINFO = "userInfo"
let USER_DEFAULT_KEY_CLIENT_ID = "clientId"
let USER_DEFAULT_KEY_DEVICE_TOKEN = "deviceToken"
let USER_DEFAULT_KEY_SPEECH_OFF = "speechOff"

//弹出框显示信息
let INVALID_PHONE_NUM = "请输入有效电话"
let INVALID_VERIFY_CODE = "请输入手机验证码"
let INVALID_ACCOUNT = "请输入用户名"
let INVALID_PASSWORD = "请输入有效登录密码"

//color 
let colorTheme = UIColor(red: 47/255, green: 134/255, blue: 246/255, alpha: 1)
let colorGray = UIColor(red: 158/255, green: 158/255, blue: 158/255, alpha: 1)
let colorGray244 = UIColor(red: 244/255, green: 245/255, blue: 246/255, alpha: 1)
let colorBoldTitle = UIColor(red: 17/255, green: 17/255, blue: 17/255, alpha: 1)
let colorThemeBackground = UIColor(red: 240/255, green: 240/255, blue: 240/255, alpha: 1)
let colorEndGraduate = UIColor(red: 255/255, green: 147/255, blue: 101/255, alpha: 1)
let colorOrange = UIColor(red: 242/255, green: 175/255, blue: 3/255, alpha: 1)
let colorOrangeYellow = UIColor(red: 248/255, green: 146/255, blue: 48/255, alpha: 1)
let colorEndOrange = UIColor(red: 247/255, green: 147/255, blue: 1/255, alpha: 1)
let colorBlue = UIColor(red: 53/255, green: 176/255, blue: 237/255, alpha: 1)
let colorTitleBlue = UIColor(red: 38/255, green: 120/255, blue: 255/255, alpha: 1)
let colorRed = UIColor(red: 215/255, green: 21/255, blue: 24/255, alpha: 1)
let colorNormalText = UIColor(red: 51/255, green: 51/255, blue: 51/255, alpha: 1)
let colorOptionsBg = UIColor(red: 66/255, green: 66/255, blue: 66/255, alpha: 1)
let colorDarkGray = UIColor(red: 102/255, green: 102/255, blue: 102/255, alpha: 1)
let colorBgGray = UIColor(red: 239/255, green: 239/255, blue: 239/255, alpha: 1)
let colorGray209 = UIColor(red: 209/255, green: 209/255, blue: 209/255, alpha: 1)
let colorGreen = UIColor(red: 73/255, green: 198/255, blue: 41/255, alpha: 1)

//选择车型请求标记
let REQUEST_QUICK_INQUIRY_VEHICLE = 1
let REQUEST_ACCURATE_INQUIRY_VEHICLE = 2
let REQUEST_PRODUCT_SEARCH_VEHICLE = 3

/// tabbar高度
var SFTabbar_HEIGHT: CGFloat {
    return isBangScreen ? 83.0 : 49.0
}

/// 是否为刘海屏 true: 刘海屏 false: 非刘海屏
var isBangScreen: Bool {
    if #available(iOS 11, *) {
        guard let w = UIApplication.shared.delegate?.window, let unwrapedWindow = w else { return false }
        
        if unwrapedWindow.safeAreaInsets.bottom > 0 {  return true }
    }
    return false
}


/// 状态栏高度
var SFStatus_Height: CGFloat {
    let statusBarH: CGFloat = UIApplication.shared.statusBarFrame.size.height
    if statusBarH > 0 {
        return statusBarH
    }else {
        return isBangScreen ? 44.0 : 20.0
    }
}

/// 导航条高度
var SFNavibar_Height: CGFloat {
    return 44.0
}

/// 状态栏+导航条高度
var SFNavBarAndStatusBar_HEIGHT: CGFloat {
    return SFStatus_Height + SFNavibar_Height
}
typealias Callback = ()->()
typealias Callbackone = ( Any )->()

typealias Callbacktwo = (NSInteger,Any )->()
typealias Callbackthree = (NSInteger, Bool, Any )->()

typealias Callbackstring = (String) ->()
